-
Notifications
You must be signed in to change notification settings - Fork 19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RTC-15334: Fix crash caused by a race condition #397
Conversation
} | ||
else | ||
|
||
if (endpoint.getTransportType() != ice::TransportType::UDP) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe this was another bug. If we received something that was not properly authenticated on UdpEndpoint, we would close UdpEndpoint which is shared port 10000
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice catch. I guess this contention on hmac computer becomes more severe with use of ipv6 and higher traffic.
Most of the time a client will not probe at all before call and if it does, it fires at udp ipv4 before it does tcp v4, if at all. Even if multiple clients probe simultaneously they are serialized over the udp endpoint recvjobqueue. But with ipv6 udp there are two parallell paths.
When I was doing this I was thinking in add two (or more) queues with their own hmacComputer instance and use round robin too avoid contention. Decided that probably is not worth, as you said, this is something that clients do once in a while, then there will be not much pressure on this endpoint I believe. And everything gets conteined already by endpoint queues, so don't think this will cause much delays (only when process different endpoints in simultaneous), still the client should use the lowest response time after an X number of stun responses, which hopefully is enough to avoid wrong decision due contention |
I believe this fix the crash we have seen on compute hmac.
The crash happens to a race condition. STUN packets that are addressed to ProbeServer are being processed on Endpoint jobQueue. If multiple STUN packets arrives in different endpoint (udp ipv4, udp ipv6, tcp ipv4, tcp ipv6) the race can happen on
_hmacComputer
.To fix that, ProbeServer now has it's own jobQueue